{% set SERVER = pillar['server'] %}
{% set APP_LOCATION =  pillar['app_location'] %}
{% set GIT_PREVIOUS_SUCCESSFUL_COMMIT = pillar['commit'] %}
{% set SERVER = pillar['server'] %}
rollback_conf:
  file.recurse:
    - name: {{APP_LOCATION}}/{{SERVER}}/conf
    - source: salt://backup/{{SERVER}}/{{GIT_PREVIOUS_SUCCESSFUL_COMMIT}}/conf
    - include_empty: True
    - replace: True
    - clean: True

rollback_lib:
  file.recurse:
    - name: {{APP_LOCATION}}/{{SERVER}}/lib
    - source: salt://backup/{{SERVER}}/{{GIT_PREVIOUS_SUCCESSFUL_COMMIT}}/lib
    - include_empty: True
    - replace: True
    - clean: True